package com.hksj.em.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hksj.common.core.model.Rest;
import com.hksj.em.entity.CallOrder;
import com.hksj.em.query.CallCaregiverQuery;
import com.hksj.em.service.CallCaregiverService;
import com.hksj.em.vo.CallOrderVO;
import com.hksj.em.vo.DevicesVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Api(tags = "信息发布屏")
@RestController
@RequestMapping("/api/callOrderInfo")
public class CallCaregiverController {

    @Autowired
    private CallCaregiverService callCaregiverService;


    @ApiOperation(value = "查询每个手术室最新记录!")
    @PostMapping("/callOrdeInfo")
    public Rest<IPage<CallOrderVO>> callOrderInfo(@RequestBody CallCaregiverQuery  query) {
        IPage<CallOrderVO> page = callCaregiverService.callOrderInfo(query);
        return Rest.ok(page);
    }


    @ApiOperation(value = "查询playStatus为0的最新记录!")
    @PostMapping("/queryLatestRecord")
    public Rest<CallOrderVO> queryLatestRecord() {
        CallOrderVO record = callCaregiverService.queryLatestRecord();
        return Rest.ok(record);
    }

    @ApiOperation(value = "更新护工清洁信息发布屏信息状态")
    @PostMapping("/updateCallOrderInfo")
    public Rest<String> updateCallOrderInfo(@RequestBody CallOrder callOrder) {
        return callCaregiverService.updateCallOrderInfo(callOrder);
    }

    @ApiOperation(value = "更新播报状态")
    @PostMapping("/updatePlayStatus")
    public Rest<String> updatePlayStatus(@RequestBody CallOrder callOrder) {
        return callCaregiverService.updatePlayStatus(callOrder);
    }


}
